/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "maitriser_soft")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MaitriserSoft.findAll", query = "SELECT m FROM MaitriserSoft m"),
    @NamedQuery(name = "MaitriserSoft.findByNiveau", query = "SELECT m FROM MaitriserSoft m WHERE m.niveau = :niveau"),
    @NamedQuery(name = "MaitriserSoft.findBySoftware", query = "SELECT m FROM MaitriserSoft m WHERE m.maitriserSoftPK.software = :software"),
    @NamedQuery(name = "MaitriserSoft.findByIdentifiant", query = "SELECT m FROM MaitriserSoft m WHERE m.maitriserSoftPK.identifiant = :identifiant")})
public class MaitriserSoft implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected MaitriserSoftPK maitriserSoftPK;
    @Basic(optional = false)
    @Column(name = "NIVEAU")
    private int niveau;
    @JoinColumn(name = "SOFTWARE", referencedColumnName = "SOFTWARE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Software software1;
    @JoinColumn(name = "IDENTIFIANT", referencedColumnName = "IDENTIFIANT", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Candidat candidat;

    public MaitriserSoft() {
    }

    public MaitriserSoft(MaitriserSoftPK maitriserSoftPK) {
        this.maitriserSoftPK = maitriserSoftPK;
    }

    public MaitriserSoft(MaitriserSoftPK maitriserSoftPK, int niveau) {
        this.maitriserSoftPK = maitriserSoftPK;
        this.niveau = niveau;
    }

    public MaitriserSoft(String software, int identifiant) {
        this.maitriserSoftPK = new MaitriserSoftPK(software, identifiant);
    }

    public MaitriserSoftPK getMaitriserSoftPK() {
        return maitriserSoftPK;
    }

    public void setMaitriserSoftPK(MaitriserSoftPK maitriserSoftPK) {
        this.maitriserSoftPK = maitriserSoftPK;
    }

    public int getNiveau() {
        return niveau;
    }

    public void setNiveau(int niveau) {
        this.niveau = niveau;
    }

    public Software getSoftware1() {
        return software1;
    }

    public void setSoftware1(Software software1) {
        this.software1 = software1;
    }

    public Candidat getCandidat() {
        return candidat;
    }

    public void setCandidat(Candidat candidat) {
        this.candidat = candidat;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maitriserSoftPK != null ? maitriserSoftPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaitriserSoft)) {
            return false;
        }
        MaitriserSoft other = (MaitriserSoft) object;
        if ((this.maitriserSoftPK == null && other.maitriserSoftPK != null) || (this.maitriserSoftPK != null && !this.maitriserSoftPK.equals(other.maitriserSoftPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.MaitriserSoft[ maitriserSoftPK=" + maitriserSoftPK + " ]";
    }
    
}
